import Vue from 'vue'
import Router from 'vue-router'
import store from '@/store'
import MainTabs from '@/views/main-tabs/MainTabs.vue'
import Home from '@/views/main-tabs/Home.vue'
import Mine from '@/views/main-tabs/Mine.vue'
import YoyoCoinIntroduce from '@/views/main-tabs/YoyoCoinIntroduce.vue'
import Article from '@/views/main-tabs/Article.vue'

import ProductsList from '@/views/products/List.vue';
import ProductDetail from '@/views/products/detail.vue';
import Cart from '@/views/products/Cart.vue';
import Pay from '@/views/products/Pay.vue';

import Query from '@/views/main-tabs/Query.vue';

import UserInfo from '@/views/mine/UserInfo/UserInfo.vue';
import Address from '@/views/mine/UserInfo/Address.vue';
import BankCard from '@/views/mine/UserInfo/BankCard.vue';

import YoyoCoins from '@/views/mine/YoyoCoins.vue';
import MyReviews from '@/views/mine/MyReviews.vue';
import MyBinds from '@/views/mine/MyBinds.vue';
import MyOrders from '@/views/mine/MyOrders.vue';
import OrderDetail from '@/views/mine/OrderDetail.vue';
import MyFavorites from '@/views/mine/MyFavorites.vue';
// import MyBadges from '@/views/mine/MyBadges.vue'
import MyCoupons from '@/views/mine/MyCoupons.vue';



Vue.use(Router)

const router = new Router({
  mode: 'hash',
  routes: [
    {
      path: '/',
      // component: MainTabs,
      // children: [
      //   { path: '', name: 'home', component: Home },
      //   { path: 'cart-tab', name: 'cartTab', component: Cart },
      //   { path: 'mine', name: 'mine', component: Mine }
      // ]
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'home',
      component: Home,
    },
    {
      path: '/mine',
      name: 'mine',
      component: Mine,
    },
    {
      path: '/yoyo-coin-introduce',
      name: 'yoyoCoinIntroduce',
      component: YoyoCoinIntroduce,
    },
    {
      path: '/productsList',
      name: 'productsList',
      component: ProductsList,
    },
    {
      path: '/products/detail',
      name: 'productDetail',
      component: ProductDetail,
    },
    {
      path: '/cart',
      name: 'cart',
      component: Cart,
    },
    {
      path: '/pay',
      name: 'pay',
      component: Pay,
    },
    {
      path: '/query',
      name: 'query',
      component: Query,
    },
    {
      path: '/user-info',
      name: 'userInfo',
      component: UserInfo,
    },
    {
      path: '/address',
      name: 'address',
      component: Address,
    },
    {
      path: '/bank-card',
      name: 'bankCard',
      component: BankCard,
    },
    {
      path: '/yoyo-coins',
      name: 'yoyoCoins',
      component: YoyoCoins,
    },
    {
      path: '/my-reviews',
      name: 'myReviews',
      component: MyReviews,
    },
    {
      path: '/my-binds',
      name: 'myBinds',
      component: MyBinds,
    },
    {
      path: '/my-orders',
      name: 'myOrders',
      component: MyOrders,
    },
    {
      path: '/order-detail',
      name: 'orderDetail',
      component: OrderDetail,
    },
    {
      path: '/my-favorites',
      name: 'myFavorites',
      component: MyFavorites,
    },
    // {
    //   path: '/my-badges',
    //   name: 'myBadges',
    //   component: MyBadges,
    // },
    {
      path: '/my-coupons',
      name: 'myCoupons',
      component: MyCoupons,
    },
    {
      path: '/article',
      name: 'article',
      component: Article,
    },

  ]
})


router.afterEach((to, from) => {
  store.dispatch('setRoute', to)
})

export default router
